<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>

<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>购物车</title>


<link rel="stylesheet"
	href="http://cdn.static.runoob.com/libs/bootstrap/3.3.7/css/bootstrap.min.css">
<script
	src="http://cdn.static.runoob.com/libs/jquery/2.1.1/jquery.min.js"></script>
<script
	src="http://cdn.static.runoob.com/libs/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<script type="text/javascript" src="/js/jquery-1.7.2.min.js"></script>
<script type="text/javascript">
	function get() {

		var value = $("#td").innerHTML;
		alert(value);
	}

	//实现全选
	function choice(isChecked) {

		var chk_list = document.getElementsByTagName("input");

		for (var i = 0; i < chk_list.length; i++) {
			if (chk_list[i].type == "checkbox") {
				chk_list[i].checked = isChecked;
			}
		}

	}
//注销
	function logout() {

		window.location.href = "/logout";
	}
</script>
</head>
<body>

	<input type="button" value="注销" onclick="logout();" />
	<div class="container">
		<div class="row clearfix">
			<div class="col-md-12 column">
				<div class="jumbotron well">
					<h3>在线购物</h3>
					<p>买买买！</p>
				</div>
				<ul class="breadcrumb">
					<li class="active">购物车</li>
				</ul>
				${errors} ${err }
				<form action="/cart/results" method="post">
					<table class="table">
						<thead>
							<tr>
								<th><input type="checkbox" id="all"
									onclick="choice(this.checked);" />全选</th>
								<th>商品编号</th>
								<th>商品名称</th>
								<th>商品单价(￥)</th>
								<th>购买数量</th>
							</tr>
						</thead>
						<tbody>
							<c:forEach items="${goodslist }" var="item">
								<tr>
									<td><input type="checkbox" name="zybgoodid"
										value="${item.goodid }" /></td>
									<td id="td">${item.goodid }</td>
									<td>${item.goodname }</td>
									<td>${item.price }</td>
									<td>${item.number }</td>
								</tr>
							</c:forEach>
						</tbody>
					</table>

					<input type="hidden" name="zybuserid"
						value="${sessionScope.u.zybuserid}" /> <input type="submit"
						value="结算选中的" class="btn btn-primary" />
				</form>

				总数量：${cm.count } 总价：
				<fmt:formatNumber value="${cm.money }" pattern="0.00" />
				<a href="/cart/result?zybuserid=${sessionScope.u.zybuserid}"
					class="btn btn-primary">全部结算</a> <a href="/user/userpagelist"
					class="btn btn-danger">返回</a>

			</div>
		</div>
	</div>
</body>
</html>